<?php
// digiboard by digitalboom.org
// http://www.digitalboom.org
//
// Information Technology program
// Sirindhorn International Institute of Technology
// Thammasat University, Rangsit Campus
// http://www.siit.tu.ac.th
//
// first created on: 2002 Mar 10
// last modified on: 2002 Mar 10

function pw2shad($pws) {
 $separator="10.01";
 for($i=0; $i<strlen($pws); $i++) {
  $str[$i]=ord(substr($pws,"$i","1"));
 }

 return($shadow=implode($separator,$str));
}

function shad2pw($shadow) {
 $separator="10.01";
 $pws="";
 $str=explode($separator,$shadow);
 for($i=0; $i<sizeof($str); $i++) {
  $pws.=chr($str[$i]);
 }
 
 return($pws);
}
?>